DateSerialItem CodeFormat

Gets or Sets the formatting string used to format the output text.

public string CodeFormat {get;Set}

Return value

string Formatting string

Following formatting strings are supported

[D] Print Date only ( eg: 3,8,22 )
[DD] Print Date only with two digits ( eg: 03,08,22 )
[DDD] Print Short day of the week (eg: Mon, Tue)
[DDDD] Print Long day of the week (Eg: Monday, Tuesday)
[M] Print month only (eg: 2,12)
[MM] Print month only with two digits ( eg: 02,12)
[MMM] Print month in short format ( eg: Jan, Feb)
[MMMM] Print month in long format ( eg: January, February)
[YY] Print year in short format ( eg: 20 , 22)
[YYYY] Print year in long format ( eg: 2020, 2022)

 

Example

Copy
 // Date Serial Item
 DateSerialItem dateSerialitem = new DateSerialItem(28, 2, 2023);
 
 // To print the date as "02/28/2023" use the following date code
 dateSerialitem.CodeFormat = "[MM]/[DD]/[YYYY]";
 // Add any strings to customize the output 
 // To print the date as "28 Tuesday of February 2023" use the following date code
 dateSerialitem.CodeFormat = "[DD] [DDDD] of [MMMM] [YYYY]";